<?php
namespace app\common\validate\Order;

use think\Validate;

// 商品订单的验证器
class Product extends Validate
{
    protected $rule =   [
        'orderid'   => 'require',
        'proid'   => 'require',
        'pronum' => ['require', 'number', '>=:1'],
        'price' => ['require', 'number', '>=:0'],
        'total' => ['require', 'number', '>=:0'],
    ];

    protected $message  =   [
        'orderid.require'     => '订单ID未知',
        'proid.require'     => '商品ID未知',

        'pronum.require'   => '商品数量必须填写',
        'pronum.number'      => '商品数量必须是数字类型',
        'pronum.>='      => '商品数量必须大于等于1',

        'price.require'   => '商品单价必须填写',
        'price.number'      => '商品单价必须是数字类型',
        'price.>='      => '商品单价必须大于等于0元',

        'total.require'   => '商品合计必须填写',
        'total.number'      => '商品合计必须是数字类型',
        'total.>='      => '商品合计必须大于等于0元',
    ];

}

?>